package cn.fl.ass.transform;

import java.util.ArrayList;
import java.util.List;

import cn.fl.ass.vo.AssTrailCarMVO;
import cn.cmm.base.framework.utils.CollectionUtils;
import fl.ass.facade.dto.AssTrailCarMDTO;
import org.springframework.beans.BeanUtils;

/**
 * @Description: 拖车信息主表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class AssTrailCarMVOTransform {


	/**
	 * DTO 转  VO
	 * @param dto AssTrailCarMDTO
	 * @return AssTrailCarMVO
	 */
	public static AssTrailCarMVO toVO(AssTrailCarMDTO dto) {
		AssTrailCarMVO  vo = null;
		if (dto != null) { 
			vo = new AssTrailCarMVO();
            BeanUtils.copyProperties(dto, vo);
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param vo AssTrailCarMVO
	 * @return AssTrailCarMDTO
	 */
	public static AssTrailCarMDTO toDTO(AssTrailCarMVO vo) {
		AssTrailCarMDTO dto = null;
		if (vo != null) {
			dto = new AssTrailCarMDTO();
            BeanUtils.copyProperties(vo, dto);
        }
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param list
	 * @return List<AssTrailCarMVO>
	 */
	public static List<AssTrailCarMVO> toVOList(List<AssTrailCarMDTO> list) {
		List<AssTrailCarMVO>  voList = new ArrayList<AssTrailCarMVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssTrailCarMDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<AssTrailCarMVO>
	 * @return List<AssTrailCarMDTO>
	 */
	public static List<AssTrailCarMDTO> toDTOList(List<AssTrailCarMVO> list) {
		List<AssTrailCarMDTO>  dtoList = new ArrayList<AssTrailCarMDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssTrailCarMVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
